package cn.com.dycc.util;

import java.io.Serializable;

/**
 * iptv Json格式输出
 * @author linfa
 *
 */
public class JsonObjectResult implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2138492113223858792L;
	
	private int code;//0:成功;1失败
	private Object data;//成功后数据
	private String msg;//失败后数据
	private String count;//统计条数
	public static final int SUCCESS=0;
	public static final int ERROR=1;
	
	public JsonObjectResult() {
		super();
	}

	public JsonObjectResult(int code, Object data, String msg, String count) {
		super();
		this.code = code;
		this.data = data;
		this.msg = msg;
		this.count = count;
	}
	
	public JsonObjectResult(Object data){
		count = "";
		code = SUCCESS;
		msg = "";
		this.data = data;
		
	}
	
	public JsonObjectResult(String count,Object data){
		this.count = count;
		code = SUCCESS;
		msg = "";
		this.data = data;
	}
	
	public JsonObjectResult(Throwable e){
		count = "";
		code=ERROR;
		data="";
		msg=e.getMessage();
	}
	
	public JsonObjectResult(int code,Throwable e){
		count = "";
		this.code=code;
	    data="";
		msg=e.getMessage();
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getCount() {
		return count;
	}

	public void setCount(String count) {
		this.count = count;
	}

	public static int getSuccess() {
		return SUCCESS;
	} 

	
	
	
	
}
